/*

	Timer.h
	
	Timer class used for handling all game
	time.
	
	Written by Sigurd Suhm 2009

*/

#ifndef _TIMER_H
#define _TIMER_H

// Includes
#include "IKernelComponent.h"		// Kernel component interface header

namespace EraAstral
{
	namespace core
	{
		class Timer : public IKernelComponent
		{
			private:
				// Is the timer running?
				bool	m_isRunning;
				// Total number of ticks since start
				unsigned int	m_ticksTotal;
				// Number of ticks since last frame
				unsigned int	m_ticksSinceLast;
				// Tick count when timer was started
				unsigned int	m_ticksStart;
			
			public:
				// Default constructor
				Timer();
				// Default destructor
				~Timer();
				
				// Update method
				void Update(unsigned int ticks);
				
				// Start and stop methods
				void Start();
				void Stop();
				
				// Forces the timer to sleep for a specified number of miliseconds
				void Sleep(unsigned int miliseconds);
				
				// Accessors
				bool	IsRunning();		// Returns true if the timer has been started
				
				unsigned int GetTicksTotal();		// Gets total number of ticks since timer start
				unsigned int GetTicksSinceLast();		// Gets number of ticks since last update
		};
	}
}

#endif		// _TIMER_H
